From: Julian Sparber Date: Sat, 27 Jan 2024 13:18:41 +0000 (+0100) Subject: messageTray: Support setting notification icon by name X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~28 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=daa8ea5ab2f9c6d7dec23c5087a2adebe726c0c6;p=gnome-shell.git messageTray: Support setting notification icon by name Since we now display the source icon and an image for the notification, it's quite common to set an icon from a name. Therefore add a convenience property to do so. Part-of: --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 7427b4a51..479044a3a 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -431,6 +431,17 @@ export const Notification = GObject.registerClass({ this.emit('updated', params.clear); } + get iconName() { + if (this.gicon instanceof Gio.ThemedIcon) + return this.gicon.iconName; + else + return null; + } + + set iconName(iconName) { + this.gicon = new Gio.ThemedIcon({name: iconName}); + } + // addAction: // @label: the label for the action's button // @callback: the callback for the action